home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / prog / asm_0_m.arj / BACKWARD.ASM < prev    next >
Assembly Source File  |  1980-01-01  |  3KB  |  104 lines

  1. page ,132        ;buy wide paper. All real computers use wide paper.
  2. name yes        ;yes, we have a name, but it's secret.
  3. ;
  4. ;****************************************
  5. ;*                    *
  6. ;*    Good Programming Practice    *
  7. ;*     and proper use of long        *
  8. ;*      variable names.        *
  9. ;*                    *
  10. ;*                    *
  11. ;* created T. Jennings 32 June -82    *
  12. ;*     edit errors 17 Oct. 92        *
  13. ;*                    *
  14. ;*                    *
  15. ;****************************************
  16. ;
  17. ;Cause the machine to enter a very stable and
  18. ;safe state where no harm can be done to precious
  19. ;disk files.
  20. ;
  21. a_long_arbitrary_name segment byte 'code'
  22. assume cs:a_long_arbitrary_name,ds:a_long_arbitrary_name
  23.  
  24. cpm    equ    0        ;now, it's not that bad,
  25. msdos    equ    $        ;that's what the fuss's over,
  26.  
  27. one_hundred_hex_or_two_fifty_six_decimal    equ 100h
  28. nine                        equ 1001b
  29. carriage_return                    equ 0dh        ;carriage?? 
  30. sicks                        equ 6
  31. line_feed                    equ 0ah
  32. four                        equ '4'
  33. dollar_sign_instead_of_more_sensible_zero    equ '$'
  34.  
  35. if cpm                    ;if it even smells like CP/M,
  36.     diddy wah diddy            ;generate cryptic error messages,
  37.     call call            ;after all, this is a real system now.
  38. endif
  39.     org    one_hundred_hex_or_two_fifty_six_decimal
  40.  
  41. this_is_the_start_of_the_program:
  42.     mov    ax,cs                ;Set all the wonderful segment
  43.     mov    ds,ax                ;registers. A processor with so
  44.     mov    ss,ax                 ;many is obviously superior to
  45.     mov    es,ax                 ;any other.
  46.     mov    sp,offset after_a_block_of_dws    ;Smash Pointer now harmless.
  47.     mov    bp,'eh'                ;Important constant.
  48.  
  49.     mov    dx,offset a_message_for_the_fool_who_runs_this_program
  50.     call    print_an_ascii_string_pointed_to_by_the_dx_register
  51.  
  52.     cli                    ;interrupts too complicated.
  53.     lock hlt                ;Nirvana.
  54.  
  55. ;
  56. ;Print an ascii string pointed to by DX on the TTY. (What?) If a message does 
  57. ;not appear, you probably ran it on your ZX-81. Try changing memory cards, 
  58. ;or face south and say, "IBM".
  59. ;
  60. print_an_ascii_string_pointed_to_by_dx:
  61.     mov    bx,dx                ;Priesthood requires random
  62. here_is_where_we_loop:                ;register changes to confuse
  63.     mov    al,[bx]                ;neophytes,
  64.     cmp    al,dollar_sign_instead_of_more_sensible_zero
  65.     je    were_done_typing_the_string
  66.     add    bx,bp
  67.     sub    bx,'eg'                ;this helps, too.
  68.     call    type_the_contents_of_al_on_the_system_console
  69.     jmp    here_is_where_we_loop
  70. were_done_typing_the_string:
  71.     ret
  72. ;
  73. ;Type the contents of al on the system console.
  74. ;
  75. type_the_contents_of_al_on_the_system_console:
  76.     mov    dl,al                ;look! self documenting code!
  77.     mov    ah,sicks
  78.     int    '!'
  79.     ret
  80.  
  81. a_message_for_the_fool_who_runs_this_program label byte
  82.     db    carriage_return,line_feed
  83.     db    "Now you dun it."
  84.     db    dollar_sign_instead_of_more_sensible_zero
  85.  
  86.     dw    one_hundred_hex_or_two_fifty_six_decimal dup (?)
  87.  
  88. after_a_block_of_dws label word
  89.  
  90. a_long_arbitrary_name ends; here
  91.  
  92.     end;, thank god.
  93. _or_two_fifty_six_decimal dup (?)
  94.  
  95. after_a_block_of_dws label word
  96.  
  97. a_long_arbitrary_name ends; here
  98.  
  99.     end;, thank god.
  100. _or_two_fifty_six_decimal dup (?)
  101.  
  102. after_a_block_of_dws label word
  103.  
  104. a